package com.zyj.java;

/**
 * @program: JVMDemo
 * @ClassName IntCompTest
 * @author: YaJun
 * @Date: 2021 - 12 - 24 - 11:52
 * @Package: com.zyj.java
 * @Description: 测试解释器模式和JIT编译模式
 * -Xint: 5032
 * -Xcomp: 638
 * -Xmixed: 751
 *
 */
public class IntCompTest {

    public static void main(String[] args) {
        long start = System.currentTimeMillis();

        testPrimeNumber(1000000);

        long end = System.currentTimeMillis();


        System.out.println("花费的时间为：" + (end - start));
    }

    public static void testPrimeNumber(int count) {
        for (int i = 0; i < count; i++) {
            // 计算100以内的质数
            label:for (int j = 2; j <= 100; j++) {
                for (int k = 2; k <= Math.sqrt(j); k++) {
                    if (j % k == 0) {
                        continue label;
                    }
                }
//                System.out.println(j);
            }
        }
    }

}
